import play.*;
import play.jobs.*;
import play.test.*;
 
import models.*;
 
@OnApplicationStart
public class Bootstrap extends Job {
 
    public void doJob() {
		//Fixtures.deleteDatabase();
        // Check if the database is empty
        if(User.count() == 0) {
            Fixtures.loadModels("initial-data.yml");
			
			User u1 = User.find("byEmail", "xuyuhang@gmail.com").first();
			User u2 = User.find("byEmail", "huanglihui@gmail.com").first();
			User u3 = User.find("byEmail", "zhaofang@gmail.com").first();
			User u4 = User.find("byEmail", "guanguan@gmail.com").first();
			User u5 = User.find("byEmail", "suyuanhang@gmail.com").first();
			User u6 = User.find("byEmail", "lijian@gmail.com").first();
			User u7 = User.find("byEmail", "wangrenren@gmail.com").first();
			
			u1.addFriend(u2);
			u1.addFriend(u5);
			u2.addFriend(u3);
			u2.addFriend(u1);
			u2.addFriend(u4);
			u2.addFriend(u5);
			u2.addFriend(u6);
			u2.addFriend(u7);
			u3.addFriend(u1);
			u3.addFriend(u6);
			u4.addFriend(u2);
			u4.addFriend(u1);
			u5.addFriend(u6);
			u6.addFriend(u3);
			u7.addFriend(u2);
			
			//Circle c1 = new Circle("Sun Microsystems", "Sun Microsystems", "4120 Network Cir, Santa Clara, California", 37.39547540, -121.95381180).save();
			//Circle c2 = new Circle("Huawei Technologies", "Huawei Technologies", "2330 Central Expressway, Santa Clara, California", 37.3734190, -121.9632040).save();
        }
		
		
    }
 
}
